package com.neuq.animaladoption.mapper;

import com.neuq.animaladoption.pojo.Shelter;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ShelterMapper {

    // 新增收容所
    @Insert("insert into shelter(shelter_name,city_address,shelter_address,create_user,count_cat,count_dog,create_time,update_time)" +
            "values(#{shelterName},#{cityAddress},#{shelterAddress},#{createUser},#{countCat},#{countDog},#{createTime},#{updateTime})")
    void add(Shelter shelter);

    // 查询所有
    List<Shelter> list(String cityAddress);

    // 根据ID查询
    @Select("select * from shelter where id=#{id}")
    Shelter findByID(Integer id);

    // 更新收容所信息
    void update(Shelter shelter);

    // 根据ID删除
    @Delete("delete from shelter where id=#{id}")
    void deleteById(Integer id);
}
